#—*— codeing = utf-8 —*—
#@Time : 2022/9/16 18:37
#@Author :计科1813 38 和泽妮
#@File : 5.1.py
#@Software : PyCharm

import urllib.request
from urllib.request import urlretrieve
import tupian



import ssl
ssl._create_default_https_context = ssl._create_unverified_context



#获取页面内容

url = 'https://www.tute.edu.cn/'
response = urllib.request.urlopen(url)
s = ""
s = response.read().decode('utf-8')
print(s)


list1 = tupian.getImg(s)
print("共找到了{0}张图片".format(len(list1)))

n = int(input("请输入要下载的图片数："))
for i in range(n):
    urlretrieve(list1[i],'img{0}.jpg'.format(i))
print("下载成功")